<template>
  <div>
   <Breadcrumb
      :params1="'数据统计'"
      :params2="'数据报表'"
    ></Breadcrumb>
    <div
      style="height:300px"
      id="main"
    ></div>
  </div>
</template>
           
<script>
var echarts = require('echarts')

import _ from 'lodash'
import { reports_api } from '@/api'
export default {
  data() {
    return {
      options: {
        title: {
          text: '用户来源'
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#E9EEF3'
            }
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            boundaryGap: false
          }
        ],
        yAxis: [
          {
            type: 'value'
          }
        ]
      }
    }
  },
  methods: {},
  async mounted() {
    //  发送请求获取数据
    // this.getData()

    const { data: res } = await reports_api()
    console.log(`res,555`, res, 555)
    // var obj = { ...this.options, ...res.data }
    var obj = _.merge(this.options, res.data)

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'))
    // 绘制图表
    myChart.setOption(obj)
  }
}
</script>
<style scoped>
</style>